<?php
/**
 * Created by DreamPHP.
 * Auth : Leruge
 * Email : leruge@163.cm
 * Date : 2018/01/30 17:00
 * Url : Http://www.shangjinclub.cn/
 */

namespace app\common\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        'oldpass|原密码' => 'require',
        'password|新密码' => 'require'
    ];

    public function sceneAdd()
    {
        return $this->only(['username', 'password'])
            ->append('username|会员账号', ['require', 'unique:user'])
            ->append('password|会员密码', ['require']);
    }

    public function sceneLogin()
    {
        return $this->only(['username', 'password', 'verify'])
            ->append('username|用户名', ['require'])
            ->append('password|密码', ['require'])
            ->append('verify|验证码', ['require', 'captcha']);
    }
}
